[v3] Skip flattening if properties would clash#3016
Closed
thomas11 wants to merge 5 commits into
Closed
Conversation
Contributor
Does the PR have any schema changes?Found 123 breaking changes: Resources
New resources:
New functions:
|
1cea3da to
7d47186
Compare
danielrbradley
left a comment
Contributor
There was a problem hiding this comment.
Yup, in principle the approach looks good for a breaking change in the next release.
Did you managed to identify is this is the same approach taken by official Azure tools when encountering the conflicts with flattening?
thomas11
added a commit
that referenced
this pull request
Jan 24, 2024
…3007) Support DefenderForStorageSettings resource by adding the default state to reset it to on delete, since it doesn't have an actual delete operation. Without the hard-coded exception in the last commit, the generated schema is incorrect. The cause is unrelated to the PR. What's happening is that [the Azure spec](https://github.com/Azure/azure-rest-api-specs/blob/fa8683f6725e5447cc808420c4542ce8375f0325/specification/security/resource-manager/Microsoft.Security/preview/2022-12-01-preview/defenderForStorageSettings.json) is defined as such (unrelated properties omitted): ```json "properties": { "isEnabled": { "type": "boolean", "description": "Indicates whether Defender for Storage is enabled on this storage account." }, "sensitiveDataDiscovery": { "x-ms-client-flatten": true, "$ref": "#/definitions/SensitiveDataDiscoveryProperties" } } ``` Where SensitiveDataDiscoveryProperties is: ```json "properties": { "isEnabled": { "type": "boolean", "description": "Indicates whether Sensitive Data Discovery should be enabled." } } ``` The nested object is annotated with x-ms-client-flatten, causing the object to be flattened, causing the two identical `isEnabled` properties to collide. #3016 will fix this in v3. In the meantime, I added a manual exception. Resolves #2996
Contributor
Author
|
superceded by #3801 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Skip the flattening of nested properties indicated by x-ms-client-flatten if it would lead to overwriting a property, creating incorrect schema and SDKs. This case happens when inner and outer property have the same name, for a report on all occurrences see #3013.
This change is breaking and could therefore only be applied to v3 of the provider. The purpose of the PR is mainly to illustrate the SDK changes that would result.
Note: remember to remove exception added in #3007.